﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
 

public partial class Frame_frmPModuleList : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //SystemOption sysOption = new SystemOption();
            //hidPageCount.Value = sysOption.GetPageSize().ToString();
            //LoadPmodule();
        }
    }

    public void LoadPmodule()
    {

        //ModuleBL moduleBL = new ModuleBL();

        //List<PMODULE> groupList = moduleBL.GetAllPModule();
        //this.grdPModule.DataSource = groupList;
        //grdPModule.PageSize = int.Parse(hidPageCount.Value);

        //grdPModule.DataBind();

        
        //if (groupList == null)
        //{
        //    lblDataCount.Text = "共有0条记录。";
        //}
        //else
        //{
        //    int count = groupList.Count;
        //    lblDataCount.Text = "共有" + count.ToString() + "条记录。";
        //}
    }


    /// <summary>
    /// 子模块信息维护
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnCModule_Click(object sender, EventArgs e)
    {
        LinkButton linkBtn = sender as LinkButton;
        Response.Redirect("frmCModuleList.aspx?pmref=" + linkBtn.CommandArgument.ToString() );
    }
    /// <summary>
    /// 编辑
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        LinkButton linkBtn = sender as LinkButton;
        Response.Redirect("frmPModuleDetail.aspx?pmref=" + linkBtn.CommandArgument.ToString() );
    }
    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        //LinkButton linkBtn = sender as LinkButton;
        //string pmref = linkBtn.CommandArgument.ToString();
        //try
        //{
        //    ModuleBL moduleBL = new ModuleBL();

        //    if (moduleBL.GetCModuleByPmref(pmref).Count > 0)
        //    {
        //        lblMessage.Text = " 无法删除，请先删除其子模块。";
        //    }
        //    else
        //    {

        //        if (moduleBL.DeletePModule(pmref))
        //        {
        //            lblMessage.ForeColor = System.Drawing.Color.Green;
        //            lblMessage.Text = " 删除成功。";
        //        }

        //        else
        //        {
        //            lblMessage.Text = "保存失败。";
        //        }
        //    }
        //    LoadPmodule();
        //}
        //catch
        //{
        //    this.lblMessage.Text = "连接数据库失败。";

        //}
    }
    /// <summary>
    /// 增加
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Response.Redirect("frmPModuleDetail.aspx");
    }
}
